#include <cstdio>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	return b==0 ? a : gcd(b,a%b);
}
int main(void){
	int a,b;
	while(~scanf("%d%d",&a,&b)){
		printf("%d\n",gcd(a,b));
	}
	return 0;
}
